package com.example.demo.controller;


import com.example.demo.entity.po.StatsOverview;
import com.example.demo.service.StatsService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import java.util.List;
import java.util.Map;

@RestController
@RequestMapping("/api/stats")
public class StatsController {

    @Autowired
    private StatsService statsService;

    @GetMapping("/overview")
    public StatsOverview getOverview() {
        return statsService.getOverview();
    }

    @GetMapping("/trends")
    public List<Map<String, Object>> getActiveUserTrend() {
        return statsService.getActiveUserTrend();
    }

    @GetMapping("/content-types")
    public List<Map<String, Object>> getContentTypes() {
        return statsService.getContentTypes();
    }

    @GetMapping("/hot-topics")
    public List<Map<String, Object>> getHotTopics() {
        return statsService.getHotTopics();
    }

    @GetMapping("/age-distribution")
    public List<Map<String, Object>> getAgeDistribution() {
        return statsService.getAgeDistribution();
    }
}